{% extends "admin/base_site.html" %}
{% load i18n admin_static %}
{% load url from future %}

{% block nav-global %}{% endblock %}

{% block content_title %}{% blocktrans %}<a class="brand">Login</a>{% endblocktrans %}{% endblock %}

{% block breadcrumbs %}{% endblock %}

{% block content %}
{% if form.errors and not form.non_field_errors and not form.this_is_the_login_form.errors %}
<div class="alert alert-error">
{% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
</div>
{% endif %}

{% if form.non_field_errors or form.this_is_the_login_form.errors %}
{% for error in form.non_field_errors|add:form.this_is_the_login_form.errors %}
<div class="alert alert-error">
    {{ error }}
</div>
{% endfor %}
{% endif %}

<div id="content-main">
<form class="form-horizontal" action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
  <div class="control-group">
    <div class="control-label">
        <label for="id_username" class="required">{% trans 'Username:' %}</label> 
    </div>
    <div class="controls">
        {{ form.username }}
        {% if not form.this_is_the_login_form.errors %}<span class="help-inline">{{ form.username.errors|striptags }}</span>{% endif %}
    </div>
  </div>
  <div class="control-group">
    <div class="control-label">
        <label for="id_password" class="required">{% trans 'Password:' %}</label> 
    </div>
    <div class="controls">
        {{ form.password }}
        {% if not form.this_is_the_login_form.errors %}<span class="help-inline">{{ form.password.errors|striptags }}</span>{% endif %}
    </div>
    <input type="hidden" name="this_is_the_login_form" value="1" />
    <input type="hidden" name="next" value="{{ next }}" />
  </div>
  {% url 'admin_password_reset' as password_reset_url %}
  {% if password_reset_url %}
  <div class="control-group">
    <div class="controls">
        <a href="{{ password_reset_url }}">{% trans 'Forgotten your password or username?' %}</a>
    </div>
  </div>
  {% endif %}
  <div class="form-actions">
    <input type="submit" value="{% trans 'Log in' %}" class="btn btn-primary" />
  </div>
</form>

<script type="text/javascript">
document.getElementById('id_username').focus()
</script>
</div>
{% endblock %}
